package models

import (
	"beego/comm/source"

	"github.com/astaxie/beego"
	"github.com/astaxie/beego/orm"
	_ "github.com/go-sql-driver/mysql"
)

type User struct {
	Id       string `orm:"column(user_id);pk"`
	UserName string `json:"userName" orm:"column(user_name)"`
	Password string `json:"password" orm:"column(user_pwd)"`
	UserRole string `json:"userRole" orm:"column(user_role)"`
}

func (ctx *User) TableName() string {
	return "user_info"
}

func init() {
	beego.Info("连接mysql数据库...")
	orm.RegisterDataBase("default", "mysql", source.Src.GetMysqlConnStr())
	beego.Info("mysql数据库连接完成")
	orm.RegisterModel(new(User))
	orm.RunSyncdb("default", false, true)
}
